$(document).ready(function() {
  setTimeout('update_status()',1000);
  $("#tabs").tabs();
  $("#runtime_status").empty();
});

function update_status() {
  $.ajax({
    url:      "cloudAnalysis.php",
    type:     "GET",
    data:     '',
    success:  function(msg)
    {
      $('#icas_status').empty();
      $('#icas_status').append(msg);
      setTimeout('update_status()',10000);
      $('#tabs_3').empty();
      $('#tabs_3').append("<iframe src='http://140.110.30.2:50030/jobtracker.jsp#running_jobs' width='90%' height='300'>Loading</iframe>");
    }
  });
}

function upload_file() {
  $('#form2').submit();
  $("#process_status").append("檔案上傳中,請稍候...<img src='images/loading.gif'>");
}

function do_runtime() {
  $("#process_status").append("處理中,請稍候...<img src='images/loading.gif'>");
  $.ajax({
    url:      "runtime.php",
    type:     "POST",
    data:     '',
    success:  function(msg)
    {
	$("#tabs").tabs("select",1);
	$("#process_status").empty();
    }
  });
}
